﻿#region 命名空间

using System;
using System.Collections.Generic;
using System.Linq;
using Sharp.Domain.PlatformBoundedContext.PermissionModule.Aggregates;
using Sharp.Domain.Repositories;
using Sharp.Infrastructure;
using Sharp.Domain.Repository.EF;

#endregion

namespace Sharp.Domain.PlatformBoundedContext.UserModule.Aggregates
{
    public partial class RoleRepository : Repository<int,Role>, IRoleRepository
    {
        /// <summary>
        /// 获取角色权限
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public IEnumerable<Permission> GetPermissionByRoleId(int roleId)
        {
            var role = Get(x => x.Id == roleId, x => x.Permissions);

            return role.Permissions.ToList();
        }

        //public Result Delete(Guid[] ids)
        //{
        //    var newids = ids.ToList();
        //    newids.Remove(new Guid("00000000-4444-4444-4444-444444444444"));//系统自带的组不能参与删除

        //    Remove(newids);

        //    return new Result();
        //}
    }
}